package com.wc.fortnight_blue_bridge.Q231019.小鸡变鸡腿;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/20 1:17
 * @description https://www.lanqiao.cn/problems/19931/learning/?contest_id=212
 */
public class Main {
    /**
     * 唯一分解定理
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static boolean[] st = new boolean[N];
    static int[] primes = new int[N];
    static long[] f = new long[N];
    static int cnt = 0;

    public static void main(String[] args) {
        ola(N - 1);
        int bound = -1;
        for (int i = 1; i < N; i++) {
            long x = i;
            long res = 1;
            for (int j = 0; primes[j] <= x / primes[j]; j++) {
                if (x % primes[j] == 0) {
                    long s = 0;
                    while (x % primes[j] == 0) {
                        s++;
                        x /= primes[j];
                    }
                    res = res * (i * s + 1);
                }
            }
            if (x > 1) res = res * (i + 1);
            f[i] = res;
            if (f[i] > (long) 1e18) {
                bound = i;
                break;
            }
        }
        int T = sc.nextInt();

        while (T-- > 0) {
            long k = sc.nextLong();
            int res = 0;
            for(int i = 1; i <= bound; i++) {
                if (f[i] >= k) {
                    res = i;
                    break;
                }
            }
            out.println(res);
        }
        out.flush();
    }

    static void ola(int n) {
        st[0] = st[1] = false;
        for (int i = 2; i <= n; i++) {
            if (!st[i]) primes[cnt++] = i;
            for (int j = 0; primes[j] <= n / i; i++) {
                st[primes[j] * i] = true;
                if (i % primes[j] == 0) break;
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
